﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SLogo.Compile
{
    /// <summary>
    /// 中间代码结构
    /// </summary>
    class IntermediateCode
    {
        /// <summary>
        /// 操作符
        /// </summary>
        public String Operator { get; set; }
        /// <summary>
        /// 参数列表
        /// </summary>
        public List<Agument> Arguments { get; set; }
        /// <summary>
        /// 操作结果
        /// </summary>
        public Variable Result { get; set; }
        /// <summary>
        /// 产生此中间代码的文件
        /// </summary>
        public String FileName { get; set; }
        /// <summary>
        /// 产生此中间代码的位置
        /// </summary>
        public int Line { get; set; }

        /// <summary>
        /// 初始化
        /// </summary>
        public IntermediateCode()
        {
            Operator = "";
            Arguments = new List<Agument>();
        }

        /// <summary>
        /// 带全部参数的构造函数
        /// </summary>
        /// <param name="op">操作符</param>
        /// <param name="arguments">参数列表</param>
        /// <param name="result">结果</param>
        /// <param name="fileName">文件名</param>
        /// <param name="line">行号</param>
        public IntermediateCode(String op, List<Agument> arguments, Variable result,String fileName, int line)
        {
            Operator = op;
            Arguments = arguments;
            Result = result;
            FileName = fileName;
            Line = line;
        }
    }
}
